package com.carp.springframework.util;

import java.util.Optional;

/**
 * @author lile
 * @date 2023/2/13
 */
public class ClassUtils {

    public static ClassLoader getDefaultClassLoader() {
        ClassLoader cl = null;
        try {
            cl = Thread.currentThread().getContextClassLoader();
        } catch (Throwable e) {
            // Cannot access thread context ClassLoader - falling back to system class loader...
        }
        return Optional.ofNullable(cl).orElse(ClassUtils.class.getClassLoader());
    }

}
